package online.heycm.codegenerator.common.types;

import online.heycm.platform.common.entity.exception.BizException;

import java.util.Arrays;

/**
 * @author hey
 * @version 1.0
 * @date 2023/12/21 11:36
 */
public enum GeneratorType {

    MyBatis("MyBatis"),
    MyBatis_Plus("MyBatis Plus");

    private final String type;

    GeneratorType(String type) {
        this.type = type;
    }

    public static GeneratorType of(String type) {
        return Arrays.stream(values()).filter(e -> e.type.equalsIgnoreCase(type)).findAny()
                .orElseThrow(() -> new BizException("无效的生成器类型"));
    }
}
